#include <stdio.h>
typedef struct
{
	int nd;
	int da;
	int sg;
	char kq[10];
}dulieu;
void nhap(dulieu &dl)
{
	printf("Nhap nhiet do ");
	scanf("%d",&dl.nd);
	printf("Nhap do am ");
	scanf("%d",&dl.da);
	printf("Nhap suc gio ");
	scanf("%d",&dl.sg);
	printf("Nhap suc ket qua: ");
	scanf("%s",dl.kq);
	
}
void writefile(dulieu dl)
{
	FILE *f;
	f=fopen("data.txt","a+");
	if(f!=NULL)
	{
		fprintf(f,"%d \t %d \t %d \t %s\n",dl.nd,dl.da,dl.sg,dl.kq);
		printf("Ghi file thanh cong\n");
		//fscanf(f,"%d \t %d \t %d \t %s\n",dl.nd,dl.da,dl.sg,dl.kq);
		//printf("%d \t %d \t %d \t %s\n",dl.nd,dl.da,dl.sg,dl.kq);
	}
}
int main()
{
	dulieu dl;
	nhap(dl);
	writefile(dl);
	fflush(stdin);
	getc(stdin);
	return 0;
}
